using IFix.Core;
using System;
using System.Collections;
using System.Collections.Generic;

namespace IFix
{
	public class ILFixInterfaceBridge : AnonymousStorey, System.Collections.IEnumerator, System.Collections.Generic.IEnumerator<object>, System.IDisposable
	{
		private VirtualMachine virtualMachine;

		private int methodId_0;

		private int methodId_1;

		private int methodId_2;

		private int methodId_3;

		private int methodId_4;

		object System.Collections.Generic.IEnumerator<object>.Current
		{
			[IDTag(1)]
			get
			{
				Call call = Call.Begin();
				call.PushObject(this);
				this.virtualMachine.Execute(this.methodId_1, ref call, 1, 0);
				return call.GetObject(0);
			}
		}

		object System.Collections.IEnumerator.Current
		{
			[IDTag(2)]
			get
			{
				Call call = Call.Begin();
				call.PushObject(this);
				this.virtualMachine.Execute(this.methodId_2, ref call, 1, 0);
				return call.GetObject(0);
			}
		}

		[IDTag(0)]
		public bool MoveNext()
		{
			Call call = Call.Begin();
			call.PushObject(this);
			this.virtualMachine.Execute(this.methodId_0, ref call, 1, 0);
			return call.GetBoolean(0);
		}

		[IDTag(3)]
		public void Dispose()
		{
			Call call = Call.Begin();
			call.PushObject(this);
			this.virtualMachine.Execute(this.methodId_3, ref call, 1, 0);
		}

		[IDTag(4)]
		public void Reset()
		{
			Call call = Call.Begin();
			call.PushObject(this);
			this.virtualMachine.Execute(this.methodId_4, ref call, 1, 0);
		}

		public ILFixInterfaceBridge(int fieldNum, int[] methodIdArray, VirtualMachine virtualMachine) : base(fieldNum)
		{
			if (methodIdArray.Length != 5)
			{
				throw new System.Exception("invalid length of methodId array");
			}
			this.virtualMachine = virtualMachine;
			this.methodId_0 = methodIdArray[0];
			this.methodId_1 = methodIdArray[1];
			this.methodId_2 = methodIdArray[2];
			this.methodId_3 = methodIdArray[3];
			this.methodId_4 = methodIdArray[4];
		}
	}
}
